import $ from "jquery";

window.$ = $
window.jQuery = $

import "../libs/jqueryFormJs/jquery.jquery.form"
import angular from "angular";
import "../libs/bootstrap/dist/css/bootstrap.min.css";
import "../css/login.css";
import service from "./ajax";
angular.module("app",[])
.controller("login",function($scope,service){
    $scope.host='http://www.hoep.tv:81/'
    $scope.formData={};
    $scope.submit=function(){
        if($scope.login.userName.$error.required||$scope.login.passWd.$error.required){
            return
        }else{
            var Data=angular.toJson($scope.formData);
            console.log(Data);
            service.post("form",$scope.host+'/Index/login',function(data){
                console.log(data);
                if(data.code==0){
                    window.location.href=location.origin+"/views/main.html"
                }else if(data.code==1){
                    alert(data.msg);
                }
            })
        }
        
    }
})
.service("service",service)
